package com.zj.transactionspringboot01.service.impl;

import org.springframework.stereotype.Service;

import com.zj.bean.Person;
import com.zj.transactionspringboot01.dao.UserMapper;
import com.zj.transactionspringboot01.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService{
//	@Autowired
	private UserMapper userMapper;

	//Bean实例化时默认调用无参构造创建。如果只有一个有参构造，spring会调用并且把参数装配进来；如果有多个有参构造且没有无参构造，则会报错。
	public UserServiceImpl(UserMapper userMapper){
		this.userMapper=userMapper;
	}

	public void queryUser(int id) {
		Person person=userMapper.getUser(id);
		System.out.println(person);
	}

}
